<%--
  Created by IntelliJ IDEA.
  User: FT
  Date: 2020/9/27
  Time: 11:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.1.js"></script>
    <title>忘记密码</title>
    <style>
        .box {
            width: 400px;
            height: 400px;
            margin: 150px auto;
        }

        label {
            margin-top: 20px;
            display: inline-block;
            width: 100px;
        }

        #checkCode {
            padding: 0;
            margin-buttom: 0;
            border: 1px solid;
        }
    </style>
    <script>
        $(function () {
            //发送邮件事件
            $("#sendEmail").click(function () {
                $.ajax({
                    url: "${pageContext.request.contextPath}/email/sendEmail",
                    type: "post",
                    data: {emailAddr:$("#emailAddr").val()},
                    dataType: "json",
                    success: function (data) {
                        // alert(data)
                        if (data=="1"){
                            alert("发送邮件成功")
                        }else{
                            alert("发送邮件失败")
                        }
                        /*$("#makeUser").empty();
                        var html = "";
                        for (var i = 0; i < data.length; i++) {
                            html += '<input type="checkbox" name="makeUsers" value="'+data[i].id+'">'+data[i].realName;
                        }
                        $("#makeUser").append(html);*/
                    }
                });
            })
        })
    </script>
</head>
<body>
<div class="box">
    <form action="${pageContext.request.contextPath}/login/forget" method="post">
        <label>用户名</label>
        <input type="text" name="username" value="admin"><br>
        <c:if test="${error!=null}">
            <span style="color: red">${error}</span>
        </c:if>
        <br>
        <label>密码</label>
        <input type="text" name="password" value="123"><br><br>
        <label>确认密码</label>
        <input type="password" name="upassword" value="123"><br><br>
        <label>验证码</label>
        <input type="text" name="checkCode" value=""><br><br>
        <label>发送验证码</label>
        <input id="emailAddr" type="text" name="checkCode" value="1844289329@qq.com" placeholder="请输入您的邮箱">
        <input id="sendEmail" type="button" value="发送邮件">
        <br><br>
        <input type="submit" value="修改密码">
    </form>
</div>
</body>
</html>
